﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using MM.Common.Base;

namespace MMTJ
{
    public partial class FrmSelectIME : XtraForm
    {
        public FrmSelectIME()
        {
            InitializeComponent();
            int num = -1;
            string systemConfig = ConfigFunction.GetSystemConfig("IME_Name");
            for (int i = 0; i < InputLanguage.InstalledInputLanguages.Count; i++)
            {
                this.lstIME.Items.Add(InputLanguage.InstalledInputLanguages[i].LayoutName);
                if (this.lstIME.Items[i].ToString() == systemConfig)
                {
                    num = i;
                }
            }
            if (num >= 0)
            {
                this.lstIME.SelectedIndex = num;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (ConfigFunction.SetEmpConfig("IME_Name", this.lstIME.Text))
            {
                IME.SetIme(this.lstIME.Text);
                base.DialogResult = DialogResult.OK;
                base.Close();
            }
        }
    }
}
